/**
 * Created by dongp on 2016/1/28.
 */

var ui = {
    //在url地址末尾添加参数编码
    encodeURLParam:function(url,name,value){
        url += url.indexOf("?") == -1 ? "?" : "&";
        url += encodeURIComponent(name) + "=" + encodeURIComponent(value);
        return url;
    },
    request:function (paramObj) {
        var p = {
            type : "POST",
            dataType : "json",
            cache : "false",
            beforeSend : function(xhr) {

            },
            complete : function(xhr) {

            },
            dataFilter : function(data) {
                return data;
            }
        };
        p.data = p.data||{};
        p = $.extend(p,paramObj);
        var _func = p.func;
        p.success = function(resultData) {
            _func(resultData);
        };
        $.ajax(p);
    }
}
